clc;clear;
wrdLn = 15; quant_num = 10000;

u = double(fi(1568+2024i, 1, wrdLn));
x = real(u); y = imag(u); z = 0;
for iter=0:wrdLn-1
    angle = quant_num*2^(-iter);
    if (y > 0)
        new_y = y - x*(2^(-iter));
        z = z + angle;
    else            
        new_y = y + x*(2^(-iter));
        z = z - angle;
    end
    y = new_y;
end
v = z;

fprintf('2024/1568*10000 = %d\n',int16(2024/1568*10000));
fprintf('input:x = %d,y = %d\noutput %d\n',real(u),imag(u),int16(v));
